/* collect.js */

import http from "@/utils/http";

export const collectApi = {
  /**
   * 通过一级收藏文件夹名称获取对应二级目录集合
   */
  getSecondLevelCollectListByName(oneDirName) {
    return http.get(
      "/personalRecord/v1/secondLevelCollect/getList",
      oneDirName
    );
  },
  /**
   * 验证加密收藏夹密码，并获取对应二级收藏夹目录集合
   */
  validatePassword(data) {
    return http.post(
      "/personalRecord/v1/encryptCollectUser/validatePassword",
      data
    );
  },
  /**
   * 收藏对应文章
   */
  addToCollectionRecord(data) {
    return http.post("/personalRecord/v1/collects/addToCollectionRecord", data);
  },
  /**
   * 取消收藏文章
   */
  removeCollectionRecords(data) {
    return http.post(
      "/personalRecord/v1/collects/removeCollectionRecords",
      data
    );
  },
  /**
   * 判断文章当前收藏状态
   */
  isTheArticleFavorited(articleId) {
    return http.get(
      "/personalRecord/v1/collects/isTheArticleFavorited",
      articleId
    );
  },
  /**
   * 通过一级目录id获取其中所有二级目录
   */
  obtainTheCorrespondingDataThroughThePrimaryDirectoryId(data) {
    return http.post(
      "/personalRecord/v1/collects/getCollectDataByOneDirId",
      data
    );
  },
  /**
   * 获取用所有收藏记录
   */
  getAllCollectContentByUserId() {
    return http.get("/personalRecord/v1/collects/getAllCollectContent");
  },
  /**
   * 通过二级目录的id获取对应收藏内容
   */
  getCollectContentBySecondLevelId(id) {
    return http.get(
      "/personalRecord/v1/collects/getCollectContentBySecondLevelId",
      id
    );
  },
  /**
   * 通过收藏名称查询收藏内容集合
   */
  searchCollectByTitle(title) {
    return http.get("/personalRecord/v1/collects/searchCollectByTitle", title);
  },
  /**
   * 清空对应收藏记录
   */
  deleteAll() {
    return http.get("/personalRecord/v1/collects/deleteAll");
  },
  /**
   * 删除单个收藏记录
   */
  deleteASingleCollection(id) {
    return http.get("/personalRecord/v1/collects/deleteASingleCollection", id);
  },
  /**
   * 修改隐私收藏夹密码
   */
  updatePassword(data) {
    return http.post(
      "/personalRecord/v1/encryptCollectUser/updatePassword",
      data
    );
  },
};